//引入import 
import request from "@/utils/request"
import { type } from "os"
//定义练习室首页返回值的类型
export interface getMainStudioType {
	content:mainListType,
	first:boolean,
	last:boolean,
	number:number,
	numberOfElements:number,
	offset:null,
	size:number,
	sort:null,
	statistics:null,
	totalElements:number,
	totalPages:number,
	useOffset:boolean
}
export interface StudioContentType {
    canAccess: boolean
    contentCount: number
    cover: string
    createMethod: string
    creator: string
    deleteFlag: boolean
    id: string
    isDelete: number
    openOutside: number
    planAddCount: number
    planName: string
    status: string
    weekTrainedCount: number
    weekTrainedDuration: number
    weeklyPlanCount: number
    weeklyPlanDuration: number
}
export type mainListType = StudioContentType[]
//1.首页联系室的请求
export const getMainStudioList = ()=>{
    return request.get<any,getMainStudioType>(`/apis/trainingCenter/plans/search/findByUserId?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageSize=20&pageNum=0&type=system`)
}
//2.点击我的创建，请求我的创建数据
export const getGedcomList =()=>{
    return request.get<any,getMainStudioType>(`apis/trainingCenter/plans/search/findByUserId?myListCategory=my_create&access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageSize=20&pageNum=0&type=system`)
}
//3.点击我的加入，请求我的加入数据
export const getJoinList =()=>{
    return request.get<any,getMainStudioType>(`apis/trainingCenter/plans/search/findByUserId?myListCategory=my_join&access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageSize=20&pageNum=0&type=system`)
}
//4.点击我的课程
export const goMycourseList =()=>{
    return request.get<any,getMainStudioType>(`apis/trainingCenter/plans/search/findByUserId?myListCategory=my_course&access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageSize=20&pageNum=0&type=system`)
}

//历史数据类型
export interface historydataType {
    content: historydataItemsType
    first: boolean
    last: boolean
    number: number
    numberOfElements: number
    offset: null
    size: number
    sort: null
    statistics: null
    totalElements: number
    totalPages: number
    useOffset: boolean
}

export  interface historydataItemType {
    createTime: number
    creator: string
    id: string
    momentBackup: momentBackupType
    momentId: string
    momentSubject: string
    momentTitle: string
    updateTime: number
}
export type historydataItemsType  = historydataItemType[]

export interface momentBackupType{
    cover: string[]
    creator: string
    creatorBackup: creatorBackupType
    momentClassificationBackup: momentClassificationBackupType
    router: string
}
export interface creatorBackupType {
    avatar: string
    certificationType: string
    id: string
    level: number
    name: string
    vipGrade: number
}
export interface momentClassificationBackupType  {
    classification: string
    workTitle: string
}
//5.点击历史请求数据
export const getHistoryList = ()=>{
    return request.get<any,historydataType>(`apis/moment/viewRecords?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageSize=10`)
}

//额外请求-首页中关注得导航栏请求
//定义关注得类型
export  interface attentionType{
    accid: string
    account: string
    avatar: string
    avocation: attention_avocationSType
    certificationName: string
    id: string
    level: number
    vipExpireTime?: number
    vipGrade?:number
}
export interface attention_avocationType{
    groupType: string
    id: string
    name: string
    userSelect: boolean
}
export type  attention_avocationSType = attention_avocationType[]

export interface  getattentionListType {
    content: getattentionList_cotentType
    first: boolean
    last: boolean
    number: number
    numberOfElements: number
    offset: null
    size: number
    sort: null
    statistics: null
    totalElements: number
    totalPages: number
    useOffset: boolean
}
export type  getattentionList_cotentType = attentionType[]
export const getattentionList =(value:number)=>{
    return request.get<any,getattentionListType>(`apis/sns/userFollows/rec/default?access_token=12f5e215-07d3-4d51-a591-4599b7daae9a&pageNum=${value}&pageSize=8`)
}
